<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted Access');
$user		= JFactory::getUser();
$userId		= $user->get('id');
//$listOrder	= $this->escape($this->state->get('list.ordering'));
//$listDirn	= $this->escape($this->state->get('list.direction'));
//$saveOrder	= $listOrder == 'a.ordering';
?>

<?php foreach($this->items as $i => $item): ?>
	<?php 
	$canCreate	= $user->authorise('core.create',		'com_content.category.'.$item->catid);
	$canEdit	= $user->authorise('core.edit',			'com_content.article.'.$item->id);
	$canCheckin	= $user->authorise('core.manage',		'com_checkin') || $item->checked_out == $userId || $item->checked_out == 0;
	$canEditOwn	= $user->authorise('core.edit.own',		'com_content.article.'.$item->id) && $item->created_by == $userId;
	$canChange	= $user->authorise('core.edit.state',	'com_content.article.'.$item->id) && $canCheckin;
	?>
	<tr class="row<?php echo $i % 2; ?>">
		<td>
			<?php echo $item->id; ?>
		</td>
		<td>
			<?php echo JHtml::_('grid.id', $i, $item->id); ?>
		</td>
		<td>
			<?php if ($canEdit || $canEditOwn) : ?>
				<a href="<?php echo JRoute::_('index.php?option=com_dream&task=dream.edit&id='.$item->id);?>">
					<?php echo $this->escape($item->content); ?></a>
			<?php else : ?>
				<?php echo $this->escape($item->content); ?>
			<?php endif; ?>
		</td>
		<td>
			<?php echo $item->str_number;?>
		</td>
		<td style="text-align: center;">
			<?php echo $item->cat_name;?>
		</td>
	</tr>
<?php endforeach; ?>